<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/23
 * Time: 15:19
 * name:添加合同订单
 * url:/erpOrder/add
 */
$oo_osid                    = $route->bodyParams['oo_osid'];                                        //学员id
$oo_real_price              = $route->bodyParams['oo_real_price'];                                  //实收费用
$oo_debt_price              = $route->bodyParams['oo_debt_price'];                                  //欠款金额
$oo_status                  = $route->bodyParams['oo_status'];                                      //订单状态 0-未处理 1-已支付 2-已退款
$oo_refund_price            = $route->bodyParams['oo_refund_price'];                                //退款金额
$oo_refund_reason           = $route->bodyParams['oo_refund_reason'];                               //退款原因
$oo_deduct_discounts        = $route->bodyParams['oo_deduct_discounts'];                            //扣除优惠
$oo_default_price           = $route->bodyParams['oo_default_price'];                               //违约金额
$oo_course_name             = $route->bodyParams['oo_course_name'];                                 //课程名称
$oo_course_price            = $route->bodyParams['oo_course_price'];                                //课程价格
$oo_sell_name               = $route->bodyParams['oo_sell_name'];                                   //对接人姓名
$oo_sell_id                 = $route->bodyParams['oo_sell_id'];                                     //对接人id
$oo_student_name            = $route->bodyParams['oo_student_name'];                                //学生姓名
$oo_ocid                    = $route->bodyParams['oo_ocid'];                                        //课程id
$oo_course_can_refund       = $route->bodyParams['oo_course_can_refund'];                           //剩余课时可退金额
$oo_give_course_can_refund  = $route->bodyParams['oo_give_course_can_refund'];                      //赠送课时可退金额
$oo_duty_cut                = $route->bodyParams['oo_duty_cut'];                                    //责任扣费
$oo_oesid                   = $route->bodyParams['oo_oesid'];                                       //机构id
$oo_ocsid                   = $route->bodyParams['oo_ocsid'];                                       //机构id
$oo_pay_type                   = $route->bodyParams['oo_pay_type'];                                 //支付方式 0-线下 1-线上
$oo_create_time             = $regexpObj->bodyV($response,$route,'oo_create_time','NORMAL');        //赠送课时
$oo_course_times            = $regexpObj->bodyV($response,$route,'oo_course_times','NUMBER');       //购买课时数
$oo_is_surplus              = $regexpObj->bodyV($response,$route,'oo_is_surplus','NUMBER');         //是否为结余
$oo_is_renew                = $regexpObj->bodyV($response,$route,'oo_is_renew','NUMBER');           //是否为续费

//写入数组
$insertArr = [
    'oo_osid'                   => $oo_osid,
    'oo_real_price'             => $oo_real_price,
    'oo_debt_price'             => $oo_debt_price,
    'oo_status'                 => $oo_status,
    'oo_refund_price'           => $oo_refund_price,
    'oo_refund_reason'          => $oo_refund_reason,
    'oo_deduct_discounts'       => $oo_deduct_discounts,
    'oo_default_price'          => $oo_default_price,
    'oo_course_name'            => $oo_course_name,
    'oo_course_price'           => $oo_course_price,
    'oo_sell_name'              => $oo_sell_name,
    'oo_sell_id'                => $oo_sell_id,
    'oo_student_name'           => $oo_student_name,
    'oo_ocid'                   => $oo_ocid,
    'oo_course_can_refund'      => $oo_course_can_refund,
    'oo_give_course_can_refund' => $oo_give_course_can_refund,
    'oo_duty_cut'               => $oo_duty_cut,
    'oo_create_time'            => $oo_create_time == NULL ? time():$oo_create_time,
    'oo_oesid'                  => $oo_oesid,
    'oo_course_times'           => $oo_course_times,
    'oo_ocsid'                  => $oo_ocsid,
    'oo_is_surplus'             => $oo_is_surplus,
    'oo_order_no'               => time().rand("000000","999999"),
    'oo_is_renew'               => $oo_is_renew,
    'oo_pay_type'               => $oo_pay_type,
];

//执行写入语句
$rsData = $db->mysqlDB->insert("oa_order",$insertArr);

//返回成功结果
$response->responseData( true, $rsData );